package com.jack.thinking.thread.core._1;

public class StopThreadTest1 {
	public static void main(String[] args) throws Exception {
		Thread tar = new Thread(new StopRunnable1());
		tar.start();
		Thread.sleep(100L);
		tar.interrupt();
	}
}


class StopRunnable1 extends Thread{

	@Override
	public void run() {
		for(int i = 0 ; i < 500000 ; i ++) {
			if(Thread.interrupted()) {
				System.out.println("已退出");
				break;
			}
			System.out.println(i);
		}
	}
	
}